package com.tensquare.hystrix.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import entity.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
@RequestMapping("qa")
public class QAController {
    @Autowired
    private RestTemplate restTemplate;
    private String URL="http://tensquare-base";

    @HystrixCommand(fallbackMethod = "aa")
    @GetMapping("hello")
    public void helle(){
        Result result= restTemplate.getForObject(URL+"/label/1",Result.class);
    }
    public void aa(){
        System.out.println("false = " + false);
    }
}
